<?php
namespace app\admin\controller;
use app\common\Apiv;
/**
 * @Author: K.EL
 * @Date:   2020-07-22 16:36:46
 * @Last Modified by:   K.EL
 * @Last Modified time: 2020-07-22 17:32:54
 */
class Images extends Base{
	function upload(){
		// 获取表单上传文件
	    $file = request()->file('file');
	    // 上传到本地服务器
	    $savename = \think\facade\Filesystem::disk('public')->putFile( 'topic', $file);
	    //协议
		$PROTOCOL = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
		$url = $PROTOCOL.$_SERVER['HTTP_HOST'].'/storage/'.$savename;
		return Apiv::result(1,0,'上传成功', $url);
	}
}